package com.mmall.example.immutable;

import com.google.common.collect.Maps;
import com.mmall.annoations.NotThreadSafe;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;

/**
 * final 修饰变量 (map 非线程安全)
 * Created by megan on 2018/3/31.
 */
@Slf4j
@NotThreadSafe
public class FinalExample {

    private final static Integer a = 1 ;

    private final static String b = "2";

    private final static Map<Integer,Integer> map = Maps.newHashMap();

    static{
        map.put(1, 2);
        map.put(3, 4);
        map.put(5, 6);
        map.put(7, 8);
    }

    public static void main(String[] args) {
        // a = 2;
        // b = "3";
        // map = Maps.newHashMap();
        map.put(1, 3);
       log.info("{}",map.get(1));
    }

    private void test(final int a){
        //a = 1 ;
    }
}
